Let's use an interval event to make the litter appear at random locations on the stage.

  • Use an Interval Event to start polluting the stage. Change the interval to 1.
  • Add Global Variable inside the event the event and change the variable to timer.
  • Use two Random Integer commands to create two random values named x and y inside the event.
  • Set the parameters of x to -225, 225 and of y to -225, 0 so that the litter only appears on the ground.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)